<template>
	<view>
		<cu-custom>
			<block slot="content">邀请函</block>
		</cu-custom>
		<view  :style="{height:(windowHeight - CustomBar)+'px'}">
			<view class="height100 flex align-center position-rel">
				<image :src="inviteImg" class="imgs"></image>
				<view class="names-wrap names-box" v-if="id==14">
					{{names}}
				</view>
				<view class="names-wrap2 names-box" v-if="id==15">
					{{names}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				CustomBar: this.CustomBar,
				windowHeight: 675,
				imgList: [],
				id:0,
				inviteImg:'',//id  为 14  15  ---  14的名字位置在 中间，15的在 下方
				names:''
			}
		},
		onLoad(option) {
			if(option.id){
				this.id = option.id;
			}
			let id = this.getUrlId();
			if(id){
				this.id = id;
			}
			if(this.id&&this.$store.state.shareId==null){
				this.$store.state.shareId = this.id;
			}else{
				this.$store.state.shareId=null;
			}
			this.windowHeight = uni.getSystemInfoSync().windowHeight;
			this.getInfo();
			this.getMine();
		},
		methods: {
			getUrlId() {
				var url = new URL(window.location.href);
				var searchParams = url.searchParams;
				return searchParams.get('id');
			},
			getMine(){
				let data = {
					
				}
				this.$http('/apicloud/User/userInfo',data).then(res=>{
					if(res.code == 200){
						let datas = res.data;
						this.names = datas.name;
					}
				})
			},
			getInfo(){
				let data = {
					
				}
				this.$http('/apicloud/User/invitation',data).then(res=>{
					if(res.code == 200){
						this.imgList = res.data;
						if(this.id){
							this.imgList.forEach(item=>{
								if(item.id == this.id){
									this.inviteImg = item.img;
								}
							})
						}
					}
				})
			},
		}
	}
</script>

<style lang="less">
	.imgs {
		width: 100%;
		height: 100%;
	}
	.names-box{
		min-width: 120rpx;
		text-align: center;
	}
	.names-wrap{
		position: absolute;
		top: 47.5%;
		left: 38%;
		color: #844c11;
	}
	.names-wrap2{
		position: absolute;
		bottom: 12%;
		left: 38.1%;
		color: #d4af6b;
	}
</style>